//
//  CLDocBeFromCell.m
//  chanlin
//
//  Created by Ryan on 15-1-26.
//  Copyright (c) 2015年 chanlin. All rights reserved.
//

#import "CLDocBeFromCell.h"
#import "UIView+Utils.h"
#import "UIImageView+WebCache.h"

@implementation CLDocBeFromCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self=[super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){
//        self.middle=[[UIView alloc] init];
//        self.middle.frame=CGRectMake(0, 0, GlobleWidth, 7.f);
//        self.middle.backgroundColor=RGB(232, 232, 232);
//        [self.contentView addSubview:self.middle];
        
//        self.contentView.layer.borderColor=RGB(0xc6, 0xc6, 0xc6).CGColor;
//        self.contentView.layer.borderWidth=0.5f;
        
        UIImageView *bg=[[UIImageView alloc] init];
        bg.frame=CGRectMake(15, 0, 290, 52);
        bg.image=[UIImage imageNamed:@"doc_befrom_bg.png"];
        
        [self.contentView addSubview:bg];
        
        
        self.icon=[[UIImageView alloc] init];
        self.icon.frame=CGRectMake(25.f, 10.f, 33.f, 33.f);
        [self.contentView addSubview:self.icon];
        
        self.title=[[UILabel alloc] init];
        self.title.font=[UIFont systemFontOfSize:13.f];
        self.title.textColor=RGB(0x3e, 0x3e, 0x3e);
        self.title.frame=CGRectMake(self.icon.right+13.f, self.icon.top+2, 200, self.title.font.lineHeight);
        [self.contentView addSubview:self.title];
        
        self.info=[[UILabel alloc] init];
        self.info.font=[UIFont systemFontOfSize:9.f];
        self.info.textColor=RGB(0x58, 0x57, 0x57);
        self.info.frame=CGRectMake(self.title.left, self.title.bottom + 6, self.title.width, 10);
        [self.contentView addSubview:self.info];
        
        UIImageView *point=[[UIImageView alloc] init];
        point.frame=CGRectMake(290, 19, 6, 11);
        point.image=[UIImage imageNamed:@"doc_befrom_point.png"];
        [self.contentView addSubview:point];

    }
    return self;
}

- (void)loadData:(NSDictionary *)dic{
    if(_isStrNotNull([dic sgrGetStringForKey:@"titlepic"])){
        [self.icon sd_setImageWithURL:[NSURL URLWithString:[dic sgrGetStringForKey:@"titlepic"]] placeholderImage:nil];
    }else{
        self.icon.image=nil;
    }
    
    self.title.text=[dic sgrGetStringForKey:@"title"];
    self.info.text=[dic sgrGetStringForKey:@"smalltext"];
}

@end
